/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.co.pas.spaceandtime.model.list;

import java.util.LinkedList;
import java.util.List;
import javax.swing.ListModel;
import javax.swing.event.ListDataListener;
import za.co.pas.spaceandtime.data.Room;

/**
 *
 * @author alabuschagne
 */
public class RoomListModel implements ListModel
{

    private List<Room> rooms = new LinkedList<Room>();

    @Override
    public int getSize()
    {
        if (getRooms() == null)
        {
            return 0;
        }
        return getRooms().size();
    }

    @Override
    public Object getElementAt(int index)
    {
        if (getRooms() == null)
        {
            return null;
        }
        return rooms.get(index);
    }

    @Override
    public void addListDataListener(ListDataListener l)
    {
    }

    @Override
    public void removeListDataListener(ListDataListener l)
    {
    }

    /**
     * @return the rooms
     */
    public List<Room> getRooms()
    {
        return rooms;
    }

    /**
     * @param rooms the rooms to set
     */
    public void setRooms(List<Room> rooms)
    {
        this.rooms = rooms;
    }
}
